// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="OneToOneConvention.cs" company="Vuscode (R)">
//   Copyright (c) Vuscode (R).  All rights reserved.
// </copyright>
// <summary>
//   Defines the OneToOneConvention type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------
namespace Vuscode.Framework.NHibernate.Conventions
{
    using FluentNHibernate.Conventions;
    using FluentNHibernate.Conventions.Instances;

    /// <summary>
    /// Defines behaviors of one to one relation convention.
    /// </summary>
    public class OneToOneConvention : IHasOneConvention
    {
        public void Apply(IOneToOneInstance instance)
        {
            instance.ForeignKey(string.Format("{0}ID", instance.EntityType.Name));
            instance.Cascade.All();
        }
    }
}